#ifndef MCPLUGINS_H
#define MCPLUGINS_H

#include <QtGui/QMainWindow>
#include <phonon>

#ifndef MEDIAFILE_H
#define MEDIAFILE_H

/**
  * Holds data about media files so it can easily be passed between objects
  * without continual database queries.
  */
class MediaFile : public QObject {
public:
    MediaFile(){ description="";}
    long mediaID; //the ID in the database for any updates that must be done
    long folderID;
    QString shortName; //the filename excluding path and extension
    QString fileLocation; //store the file location so we don't need to continually access the db
    QString description;
    QString title;
    QString artist;
    QString extension;
    QString coverArt; // store the cover art location so we don't need to continually access the db
};

class MediaFolder {
public:
    MediaFolder(long folderID, QString path) {
        this->folderID=folderID;
        this->path=path;
    }
    long folderID;
    QString path;
};
#endif

 /**
   * MenuItemInterface implementations are plugins which can show up in the main menu such as Videos or show up as a submenu of another menu such as Recorded TV inside of videos.
   * Once the plugin is selected it is then up to the plugin what to do.
   */
 class MenuItemInterface : public QObject
 {
     public:
         /**
          * Returns the name of the item as it is displayed in the menu.
          * Is also the type of file that will
          * @return the name of the item as it is displayed in the menu
          */
         virtual QString getName() = 0;

         /**
          * Returns the image that should be displayed in the menu
          *
          * @return the image that should displayed in the menu
          */
         virtual QIcon getImage() = 0;

         /**
           * Gets the graphical interface of the plugin
           *
           * @return the graphical interface
           */
         virtual QWidget * getInterface() = 0;

         /**
           * Runs the automated tests on the plugin
           */
         virtual void test() = 0;
 };

 Q_DECLARE_INTERFACE(MenuItemInterface,"brock.mediacenter.MenuItemInterface/1.0");

 /**
   * FileSelectionInterface implementations are plugins such as Videos which will feature a submenu
   * which contains a submenu with further filters such as favourites and possibly other menus such as
   * recorded tv. If a filter is selected then it will open up the media files relevant to that choice
   * in a file selector which will then give the user the ability to load the file or bring open a popup
   * menu with options such as opening a video editor.
   *
   * If another menu option is chosen then control will be delegated to that plugin.
   */
 class FileSelectionInterface : public MenuItemInterface
 {
    public:
        /**
         *  Returns the list of file extensions that may be used with the plugin on this system.
         *
         *  @return the list of usable extensions
         */
        virtual QStringList getExtensions() = 0;

        /**
          * Sets the file to be used with the plugin. Most likely to play  the video / audio.
          *
          * @param mediaFile the file for the plugin to use
          */
        virtual void setMediaFile(MediaFile * mediaFile) = 0;


        virtual QIcon getIcon(MediaFile * mediaFile) = 0;

        virtual void play() = 0;
        virtual void fastForward() = 0;
        virtual void rewind() = 0;
        virtual void stop() = 0;
        virtual void next() = 0;
        virtual void previous() = 0;

        /**
          * Sets the list of files to play and which one to start playing from
          *
          * @param files The list of files
          * @param start The index of the file to start playing first
          */
        virtual void setMediaQueue(QList<MediaFile *> * files, int start) = 0;
        virtual bool isPlaying() = 0;
        virtual void setVolume(int) = 0;

        /**
          * Sets the slider that is used to control the seek position.
          *
          * @param slider The slider to set
          */
        virtual bool setSlider(Phonon::SeekSlider * slider) =0;
};

 Q_DECLARE_INTERFACE(FileSelectionInterface,"brock.mediacenter.FileSelectionInterface/1.0");

 /**
   * StyleInterface implementations are plugins which specify replacement images for theming.
   * The images are identified by name and it is up to the GraphicsInterface implementation of how
   * what names to allow. However the standard would be that the name specified by a MenuItemInterface
   * implementation would be the same name as the one to change its image in the user interface.
   *
   * ie if a plugin is named Videos and the hash map contains a value with the key named Videos then
   * the image in the hash map corresponding with the key would be used in place of the default image for the plugin
   *
   * Background and other images such as a play button image may also be specified.
   */
 class StyleInterface : public QObject
 {
    public:


     virtual QString getName()=0;
     /**
      * Returns a Hash Map of names to images to use for styling
      *
      * @return a Hash Map of names to images to use for styling
      */
        virtual QHash<QString,QIcon> * getImages() = 0;

        /**
          * Returns a Hash Map of names to stylesheets for decorating various components. Stylesheets are just strings formatted
          * in the correct way
          *
          * @return the Hash Map of names to stylesheets
          */
        virtual QHash<QString,QString> * getStyleSheets() = 0;

 };

 Q_DECLARE_INTERFACE(StyleInterface,"brock.mediacenter.StyleInterface/1.0");

 /**
   * FileAddonInterface implementations are plugins that don't need a menu and just add something
   * to the popup menu of the given file types. When the popup menu item (ie edit) has been selected
   * control will then be given to the plugin.
   */
class FileAddonInterface
{
    public:
        /**
         * Returns the name to display in the right click menu
         *
         * @return the name to display in the right click menu
         */
        virtual QString getName() = 0;

        /**
          * Runs the automated tests on the plugin
          */
        virtual void test() = 0;
};

Q_DECLARE_INTERFACE(FileAddonInterface,"brock.mediacenter.FileAddonInterface/1.0");

/**
  * GraphicsInterface implementations are plugins which form the user interface. Only one of these
  * plugins may be active at any given time since they control the entire look and feel of the program.
  * However they should also use the suggestions from the current StyleInterface implementation
  */
class GraphicsInterface : public QObject  {
public:

        /**
          * Passes the list of plugins which form the menus
          *
          * @param plugins the menu plugins
          */
        virtual void setMainPlugins(QList<MenuItemInterface *> * plugins) = 0;

        /**
          * Passes the list of plugins which can change the style
          *
          * @param plugins the style plugins
          */
        virtual void setStylePlugins(QList<StyleInterface *> * plugins) =0;

        /**
          * Passes the list of plugins which provide addon features
          *
          * @param plugins the addon plugins
          */
        virtual void setAddonPlugins(QList<FileAddonInterface *> * plugins) =0;

        /**
          * Initializes the graphics part of the application making the program start as far as the
          * user is concerned
          */
        virtual QWidget * initialize(QWidget * parent) = 0;

        virtual void test() = 0;


};



Q_DECLARE_INTERFACE(GraphicsInterface,"brock.mediacenter.GraphicsInterface/1.0");


#endif // MCPLUGINS_H
